<?php
require_once '../../model/global.inc.php'; 

if(isset($_GET['email'])){
    $email=$_GET['email'];
    $myReg="/^[A-Za-z0-9\._-]+@[A-Za-z0-9_-]+\.([A-Za-z0-9_-][A-Za-z0-9_]+)$/";
    if(preg_match($myReg, $email)){
        $sql_check = mysql_query("select memid from tblmember where email='".$email."'") or die(mysql_error());

        if(mysql_num_rows($sql_check))
        {
            echo '<font color="red">The nickname <STRONG>'.$email.'</STRONG> is already in use.</font>';
        }
        else
        {
            echo 'OK';
        }

    }else{
        echo "<font color=red> Invalid email</font>";
    }
}
else{
    echo "<font color=red> Please enter email</font>";
}
?>